<#assign base=request.contextPath>
<!DOCTYPE html> 
<html>
	<head>
		<title>${title}</title>
		<meta charset="utf-8">
		<#include "common/reference.ftl" />
		<#include "common/am.reference.ftl" />
	</head>
	<body class="${configs["skinName"]}">
		<div class="page-content">
			<div class="row">
			<#if viewMode !="view">
			<#include "common/breadcrumb.ftl">
			</#if>
				<form id="form" role="form" class="form-horizontal" method="post" action="${base}/${form_action}">
					<div class="col-xs-12">
						<div class="widget-box">
							<div class="widget-body">
								<input type="hidden" name="driverId" id="driverId" value="${model.driverId}" <#if viewMode == "view">disabled</#if>>
								<#if viewMode == "view">
								<div class="widget-header widget-header-flat">
									<h5 class="lighter">
										${module}
									</h5>
								</div>
								<#else>
								<div class="alert alert-warning">
									<strong>提示!</strong>
									<strong style="color:#dd514c;">出现红框</strong>的表示不能为空
								</div>
								</#if>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										手机号
									</label>
									<div class="col-sm-6 input-group">
										<input type="text" id="phoneNo" name="phoneNo" value="${model.phoneNo}" class="form-control" required placeholder="请输入手机号" <#if viewMode == "view">disabled</#if>>
										<span class="input-group-addon">手机号唯一</span>
									</div>
								</div>
								<div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right">
                                        所属分公司
                                    </label>
                                    <div class="col-sm-6">
                                        <select id="companyId" name="companyId" class="chosen-select form-control"  data-placeholder="请选择所属分公司" <#if viewMode == "view">disabled</#if>>
                                            <option value="">请选择所属分公司</option>
                                            <#if companyList?exists && companyList?size gt 0>
                                            <#list companyList as item>
                                            <option value="${item.companyId}"<#if model.companyId == item.companyId>selected</#if> >${item.ownerName}</option>
                                            </#list>
                                            </#if>
                                        </select>
                                        <input type="hidden" name="companyName" value="${model.companyName}">
                                    </div>
                                </div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										身份证
									</label>
									<div class="col-sm-6">
										<input type="text" id="idCard" name="idCard" value="${model.idCard}" class="form-control" required placeholder="请输入身份证号" <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										真实姓名
									</label>
									<div class="col-sm-6">
										<input type="text" id="trueName" name="trueName" value="${model.trueName}" class="form-control" required placeholder="请输入真实姓名" <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										性别
									</label>
									<div class="col-sm-6">
										<select name="sex" class="select-chosen form-control" required <#if viewMode == "view">disabled</#if>>
											<option value="男" <#if model.sex == "男">selected</#if> >男</option>
											<option value="女" <#if model.sex == "女">selected</#if> >女</option>
										</select>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										头像
									</label>
									<div class="col-sm-6">
										<#if viewMode !="view">
										<input type="file" id="headImageFile" name="file" value="" class="form-control" data-input="headImageInput" data-image="headImagePreview">
										</#if>
										<input type="hidden" id="headImageInput" name="headImg" value="${model.headImg}"/>
										<img id="headImagePreview" alt="" src="<#if model.headImg?exists && model.headImg?length gt 0>${model.headImg}</#if>" height="60" style="display:<#if model.headImg?exists && model.headImg?length gt 0>block<#else>none</#if>" />
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										银行名称
									</label>
									<div class="col-sm-6">
										<select id="bankName" name="bankName" <#if viewMode == "view">disabled</#if> >
										<#if bankNameList?exists && bankNameList?size gt 0>
										<#list bankNameList as item>
											<option value="${item.dataValue}" <#if model.bankName == item.dataValue>selected="selected"</#if> >${item.dataName}</option>
										</#list>
										</#if>
										</select>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										绑定银行卡号
									</label>
									<div class="col-sm-6">
										<input type="text" id="bankCard" name="bankCard" value="${model.bankCard}" class="form-control" placeholder="请输入银行卡号" <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										驾龄
									</label>
									<div class="col-sm-6">
										<div class="input-group">
											<input type="text" id="driveAge" name="driveAge" value="${model.driveAge}" class="form-control js-pattern-number" required min="0" placeholder="请输入驾龄" <#if viewMode == "view">disabled</#if>>
											<span class="input-group-addon">年</span>
										</div>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										身份证正面
									</label>
									<div class="col-sm-6">
										<#if viewMode !="view">
										<input type="file" id="idCardFrontImgFile" name="file" value="" class="form-control" data-input="idCardFrontImgInput" data-image="idCardFrontImgPreview">
										</#if>
										<input type="hidden" id="idCardFrontImgInput" name="idCardFrontImg" value="${model.idCardFrontImg}"/>
										<img id="idCardFrontImgPreview" alt="" src="<#if model.idCardFrontImg?exists && model.idCardFrontImg?length gt 0>${model.idCardFrontImg}</#if>" height="60" style="display:<#if model.idCardFrontImg?exists && model.idCardFrontImg?length gt 0>block<#else>none</#if>" />
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										身份证反面
									</label>
									<div class="col-sm-6">
										<#if viewMode !="view">
										<input type="file" id="idCardBackImgFile" name="file" value="" class="form-control" data-input="idCardBackImgInput" data-image="idCardBackImgPreview">
										</#if>
										<input type="hidden" id="idCardBackImgInput" name="idCardBackImg" value="${model.idCardBackImg}"/>
										<img id="idCardBackImgPreview" alt="" src="<#if model.idCardBackImg?exists && model.idCardBackImg?length gt 0>${model.idCardBackImg}</#if>" height="60" style="display:<#if model.idCardBackImg?exists && model.idCardBackImg?length gt 0>block<#else>none</#if>" />
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										驾驶证
									</label>
									<div class="col-sm-6">
										<input type="text" id="driveCret" name="driveCret" value="${model.driveCret}" class="form-control" required placeholder="请输入驾驶证" <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										驾驶证照片
									</label>
									<div class="col-sm-6">
										<#if viewMode !="view">
										<input type="file" id="driveCretImgFile" name="file" value="" class="form-control" data-input="driveCretImgInput" data-image="driveCretImgPreview">
										</#if>
										<input type="hidden" id="driveCretImgInput" name="driveCretImg" value="${model.driveCretImg}"/>
										<img id="driveCretImgPreview" alt="" src="<#if model.driveCretImg?exists && model.driveCretImg?length gt 0>${model.driveCretImg}</#if>" height="60" style="display:<#if model.driveCretImg?exists && model.driveCretImg?length gt 0>block<#else>none</#if>" />
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										网约车资格证
									</label>
									<div class="col-sm-6">
										<input type="text" id="netCert" name="netCert" value="${model.netCert}" class="form-control"  placeholder="请输入网约车资格证" <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										运营证
									</label>
									<div class="col-sm-6">
										<input type="text" id="runCert" name="runCert" value="${model.runCert}" class="form-control"  placeholder="请输入运营证" <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										车牌号
									</label>
									<div class="col-sm-6">
										<input type="text" id="carNo" name="carNo" value="${model.carNo}" class="form-control" required placeholder="请输入车牌号" <#if viewMode == "view" || viewMode == "edit">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										车品牌
									</label>
									<div class="col-sm-6">
										<input type="text" id="carBrand" name="carBrand" value="${model.carBrand}" class="form-control" required placeholder="请输入车品牌，如本田 宝马" <#if viewMode == "view" || viewMode == "edit">disabled</#if>>
									</div>
								</div>
                                <div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										车型号
									</label>
									<div class="col-sm-6">
										<input type="text" id="carRank" name="carRank" value="${model.carRank}" class="form-control" required placeholder="请输入车型号，如帕沙特  迈腾 " <#if viewMode == "view" || viewMode == "edit">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right">
                                        车辆类型
                                    </label>
                                    <div class="col-sm-6">
                                        <input type="text" id="carType" name="carType" value="${model.carType}" class="form-control" required placeholder="请输入车品牌，如普通小型车 商务车" <#if viewMode == "view" || viewMode == "edit">disabled</#if>>
                                    </div>
                                </div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										车颜色
									</label>
									<div class="col-sm-6">
										<input type="text" id="carColor" name="carColor" value="${model.carColor}" class="form-control" required placeholder="请输入车颜色，如红色" <#if viewMode == "view" || viewMode == "edit">disabled</#if>>
									</div>
								</div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right">
                                        车座位数
                                    </label>
                                    <div class="col-sm-6">
                                        <div class="input-group">
                                            <input type="text" id="carSeats" name="carSeats" value="${model.carSeats}" class="form-control js-pattern-number" required min="0" placeholder="请输入车座位数" <#if viewMode == "view" || viewMode == "edit">disabled</#if>>
                                            <span class="input-group-addon">座</span>
                                        </div>
                                    </div>
                                </div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										运营服务
									</label>
									<div class="col-sm-6">
										<select multiple="multiple" name="serviceCodes" class="select-chosen form-control" data-placeholder="请选择运营服务" <#if viewMode == "view">disabled</#if> >
											<#if serviceList?exists && serviceList?size gt 0>
											<#list serviceList as item>
											<option value="${item.serviceCode}" <#if (!model.serviceCodes?contains(',') && model.serviceCodes == item.serviceCode) || model.serviceCodes?contains('${item.serviceCode},')  || model.serviceCodes?contains(',${item.serviceCode}') >selected="selected"</#if> >${item.serviceName}</option>
											</#list>
											</#if>
										</select>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										是否启用
									</label>
									<div class="col-sm-6">
										<input class="ace ace-switch ace-switch-7" type="checkbox" name="enabled" <#if model == null || model.enabled>checked="checked"</#if> <#if viewMode == "view">disabled</#if>>
										<span class="lbl"></span>
									</div>
								</div>
								<#if viewMode != "view">
								<div class="clearfix form-actions">
									<div class="col-md-offset-3 col-md-9">
										<button id="btnSubmit" class="btn btn-info" type="submit">
											<i class="fa fa-check bigger-110"></i>
											提 交
										</button>
									</div>
								</div>
								</#if>
							</div>
						</div>
					</div>
				</form>
			</div>	
		</div>
		<script type="text/javascript">
		$(function(){
			$('input[type="file"]').ace_file_input(imageParms).on('change',function(){
				var fileId = $(this).attr('id');
				var inputid = $(this).attr('data-input');
				var previewId = $(this).attr('data-image');
				openLoading();
				$.ajaxFileUpload({
		                url: '${base}/upload/image', 
		                type:'POST',
		                data:{module:'driver',hasRoot:true},          
		                secureuri: false,
		                fileElementId: fileId,                   //文件选择框的id属性
		                dataType: 'json',                       
		                success: function (rst){
		                    if(rst.status == 'OK' && rst.link != ''){
			                    $('#'+previewId).attr('src',rst.link).show();
		                    	$('#'+inputid).val(rst.link);
		                    }
		                    else{
		                    	layer.alert(rst.message);
		                    }
		                },
		                error: function (data, status, e) {
		                    layer.alert('上传图片失败');
		                },
		                complete:function(){
		                	closeLoading();
		                }
		          });
			});
			$('.select-chosen').chosen();
			$('#companyId').chosen();
            $('#companyId').change(function(){
                var companyId = $(this).val();
                var companyName = $(this).find('option[value="'+companyId+'"]').text();
                $('input[type="hidden"][name="companyName"]').val(companyName);
            });
            $('#companyName').trigger('change');
			$('#form').validator();
		})
		</script>
	</body>
</html>